package com.study.springcache.common.config;

import com.study.springcache.service.CacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;

/**
 * @Description:
 * @Author: 刘超
 * @Date: 2023-03-07 21:03
 */
//@Component
public class ApplicationInitConfig implements CommandLineRunner {
    @Autowired
    CacheService cacheService;

    public void init(){
        for (int i = 0; i < 5; i++) {
            cacheService.getData(i);
        }
    }

    @Override
    public void run(String... args) throws Exception {
        init();
    }
}
